package com.demo.explore.entity;

import java.time.LocalDateTime;

/**
 * 验证码封装类
 *
 * @author Logan
 *
 */
public class ValidateCode {

    /**
     * 验证码
     */
    private String code;

    /**
     * 过期时间
     */
    private LocalDateTime expireTime;

    /**
     * 指定验证码和有效分钟数的构造方法
     *
     * @param code 验证码
     * @param validityMinutes 有效分钟数
     */
    public ValidateCode(String code, int validityMinutes) {
        this.code = code;
        this.expireTime = LocalDateTime.now().plusMinutes(validityMinutes);
    }

    /**
     * 指定验证码和过期时间的构造方法
     *
     * @param code 验证码
     * @param expireTime 过期时间
     */
    public ValidateCode(String code, LocalDateTime expireTime) {
        this.code = code;
        this.expireTime = expireTime;
    }

    public String getCode() {
        return code;
    }

    public LocalDateTime getExpireTime() {
        return expireTime;
    }

}